﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace OpenCvSharpExtension
{
    public static class ControlExtension
    {
        /// <summary>
        /// 在图片控件上循环播放视频(使用OPENCV)
        /// </summary>
        /// <param name="image"></param>
        /// <param name="path"></param>
        public static VideoComponent PlayVideoLoop(this Image image, string path)
        {
            VideoComponent vc = new VideoComponent(path);
            vc.AutoReplay = true;
            vc.BitmapChanged += (s, e) =>
            {
                image.Source = vc.Bitmap;
            };
            vc.Play();
            return vc;
        }


    }
}
